package com.fxu.tpl.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/***
 * <p>fxu</p>
 * 项目类型
 * @author fangxu
 * @version 2022-03-08
 ***/
@AllArgsConstructor
public enum ProjectTypeEnum implements BaseEnum<Integer, String> {
    SPRING_BOOT(1, "spring-boot"),
    SPRING_CLOUD(2, "spring-cloud"),
    SPRING_DUBBO(3, "spring-dubbo"),
    ;

    Integer code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static String desc(Integer code) {
        ProjectTypeEnum ret = find(code);
        return ret == null ? null : ret.desc;
    }

    public static ProjectTypeEnum find(Integer code) {
        return code == null ? null : BaseEnum.findOne(values(), v -> v.code.intValue() == code.intValue());
    }
}